<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/admin.css" />
	<script type='text/javascript' src='__PUBLIC__/js/jquery.min.js'></script>
	<script type='text/javascript' src='__PUBLIC__/layer/layer.js'></script>
	<script type='text/javascript' src='__PUBLIC__/admin/js/common.js'></script>
    <title>后台管理</title>
    <style type="text/css">
        .vol_tr{background-color:#f7f7f7;}
    </style>
</head>
<body>
<div class="main-container clearfix"><div class="main-content"><div class="inner"><div class="mall-manage">
    <div class="comm-list" style="min-height:600px">
        <div class="comm-top">
            <div class="title-left">
                <{:I('get.name')}>-用药记录
            </div>
            <div class="title-right" style="top:8px;">
            <form method="get" action="<{:U('index')}>">
                <input type="hidden" name="m" value="<{:MODULE_NAME}>" />
                <input type="hidden" name="c" value="<{:CONTROLLER_NAME}>" />
                <input type="hidden" name="a" value="<{:ACTION_NAME}>" />
                <input type="hidden" name="uid" value="<{:I('get.uid')}>" />
                <input type="hidden" name="name" value="<{:I('get.name')}>" />
                <input name="keywords" class="textarea search_inp" placeholder="请输入关键词" type="text" value="<{:I('get.keywords')}>"/>
                <input value="搜索" class="btn btn-success search_btn" type="submit" />
            </form>
            </div>
        </div>
        <div class="list-table">
            <div class="wrapper">
                <table class="stable">
                    <thead>
                        <tr>
                            <th>药物名</th>
                            <th>剂量</th>
                            <th>用药时间</th>
                            <th>备注</th>
                            <th>状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        <foreach name="list" item="v">
                            <tr>
                                <td><{$v.name}></td>
                                <td><{$v.vol}></td>
                                <td><{$v.use_time}></td>
                                <td><{$v.des}></td>
                                <td><{:$v['is_use'] ? '<span style="color:#009997;">使用中</span>' : '暂停中'}></td>
                            </tr>
                        </foreach>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="page-list"><{$page}></div>
    </div>
</div></div></div></div>
<script type="text/javascript">
function delRow(id,obj){
    if(confirm('确定要删除吗？')){
        $.post("<{:U('del')}>",{id:id},function(res){
            res=$.trim(res);
            if(res=='suc'){
                note_info('删除成功',obj);
                setTimeout('location.reload()',1200);
            }else{
                note_info('删除失败',obj,'warn');
            }
        });
    }
}
//显示剂量
function showVol(obj,pid){
    if($(obj).children('span').text() == '显 示'){
        $.post("<{:U('getVolArr')}>",{pid:pid},function(res){
            var volStr = '';
            if(res.length > 0){
                var editUrl = '<{:U("edit",array("type"=>I("get.type")))}>';
                $.each(res,function(i,item){
                    volStr += '<tr class="vol_tr"><td>'+item.name+'</td><td><div class="btn-operate"><a href="'+editUrl+'&id='+item.id+'&pid='+item.pid+'" title="修改"><i class="glyphicon glyphicon-edit"></i></a><a href="javascript:void(0);" onclick="delRow('+item.id+',this)" title="删除" id="delBtn'+item.id+'"><i class="glyphicon glyphicon-trash"></i></a></div></td><td></td></tr>';
                });
            }
            $('.vol_tr').remove();
            $('.btngreen30').text('显 示');
            $(obj).parent().after(volStr);
            $(obj).children('span').text('关 闭');
        },'json');
    }else{
        $('.vol_tr').remove();
        $('.btngreen30').text('显 示');
    }
}
</script>
</body>
</html>




